// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Vuex from 'vuex'
import store from './store/store'
import App from './App'
import router from './router'
import axios from 'axios'
import './assets/css/common.less'
import './assets/css/iconfont.css'

Vue.prototype.$http = axios
Vue.config.productionTip = false
Vue.use(Vuex)

router.beforeEach((to, from, next) => {
  let pathArr = ['/warning', '/school', '/futureTheory', '/upDown']
  function check (path) {
    return path === to.path
  }
  if (pathArr.some(check)) {
    store.dispatch('setRePage', false)
    store.dispatch('setScrHeight', document.body.scrollTop)
  }
  next()
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  template: '<App/>',
  components: { App }
})
